<?php defined( '_JEXEC') or die( 'Restricted access'); // No direct access ?>
    <div class="subhead">
        <fieldset>
            <legend>
                <h3>Add new link:</h3>
            </legend>
            <p>
				<form name="form1" id="form1" method="post" action="<?php echo JRoute::_('index.php?option=com_volunteer&task=addlink') ;?>">
					Name:			
					<input type="text" name="newlinkname" value="<?php echo $this->newlinkname; ?>" /> <br />
					URL:
					<input type="text" name="newlinkurl" value="<?php echo $this->newlinkurl; ?>" />
					<input type="submit" value="Add" />
				</form>
            </p>
        </fieldset>
		<fieldset>
            <legend>
                <h3>Search existing link:</h3>
            </legend>
            <p>
				<form name="form2" id="form2" method="post" action="<?php echo JRoute::_('index.php?option=com_volunteer&task=searchlink') ;?>">
					Name:
					<input type="text" name="searchlink" value="<?php echo $this->searchlink;?>" />
					<input type="submit" value="Search" />
				</form>
            </p>
        </fieldset>
        <p>
            <b><h2>
<?php if($this->searchlink): ?>
			Search results: <?php echo sizeof($this->results); ?> link(s) found			
<?php else: ?>
			All links:
<?php endif; ?>
            </h2></b>
            
        </p>
        <table border="1" cellspacing="0" width="100%">
            <tr align="center" bgcolor="#6cb33f">
                <td width="20%">
                    <strong>
                        Name
                    </strong>
                </td>
                <td width="55%">
                    <p>
                        <strong>
                            URL
                        </strong>
                    </p>
                </td>
                <td width="25%">
                    <strong>Action</strong>
                </td>
            </tr>
<?php foreach($this->results as $link): ?>
            <tr>
                <td>
                    <?php echo $link->name; ?>
                </td>
                <td>
                    <p>
                         <a href="<?php echo $link->url; ?>"><?php echo $link->url; ?></a>
                    </p>
                </td>
                <td align="center">
                    <a href="<?php echo JRoute::_('index.php?option=com_volunteer&view=editlink&link=' . $link->id); ?>">Edit</a>
                    &nbsp;
                    <a href="<?php echo JRoute::_('index.php?option=com_volunteer&task=deletelink&link=' . $link->id); ?>" onclick="javascript:return confirm('Are you sure to delete this link? This can not be undone.')">Delete</a>
                </td>
            </tr>
<?php endforeach; ?>            
        </table>
    </div>